gtkfilechoosernativewin32: Fix support for non-ASCII paths
authorChristoph Reiter <creiter@src.gnome.org>
Fri, 2 Jun 2017 10:55:23 +0000 (12:55 +0200)
committerChristoph Reiter <creiter@src.gnome.org>
Fri, 2 Jun 2017 11:22:36 +0000 (13:22 +0200)
commita1dc9e466066dd18592559d21d8647a43169e73a
tree5fe1d760e262fab300bdd5647d32a1e5415f2fe8
parentee408d5f75756375b8cb62ea742d967764754b20
gtkfilechoosernativewin32: Fix support for non-ASCII paths

The code used SIGDN_URL to get an URL for the selected item, but Windows URLs
are a mix of unicode and percent encoded characters in the locale encoding
and not something GFile can understand. The result is a garbage file
path.

Instead use SIGDN_FILESYSPATH to get a real file path if available.

Also checks the return value of g_utf16_to_utf8 because file paths on
Windows can contain lone surrogates which would make the conversion fail.

https://bugzilla.gnome.org/show_bug.cgi?id=783347
gtk/gtkfilechoosernativewin32.c